package day0605

/**
  * @program: hadoop
  * @description: ${description}
  * @author: Qiang.Ye
  * @date: 2019-06-09 06:52
  **/
object Demo03 {

  def main(args: Array[String]): Unit = {
    //======序列Vector，Range
    var v = Vector(1,2,3,4)
    println(v)
    var r = Range(0,5)
    println(r)
    println(0 until 5)
    println(0 to 5)

    //两个Range相加
    println(('0' to '9') ++ ('A' to 'Z'))
    //Range转换成List
    println(1 to 5 toList)
    //======集：Set=====================
    var s1 = Set(1,2,10,10,8)
    println(s1)
    println(s1 + 10)
    println(s1 + 7) //s1本身不变，返回新Set
    println(s1)

    var ss2 = scala.collection.mutable.SortedSet(1,2,10,8)
    println(ss2)
    println(s1.contains(1))
    println(s1.contains(1))
    var s2 = Set(1,2,8,10,9,21,14)
    println(s1.subsetOf(s2))  //判断是s1是否为s2的子集 true
    println(s2.subsetOf(s1)) //判断是s2是否为s1的子集 false
    //集的运算  union 并集, intersect 交集  diff 差集
    var set1 = Set(1,3,4,5,6,7)
    var set2 = Set(1,5,7,9,8,10)
    println(set1 union( set2))
    println(set1 intersect( set2))
    println(set1 diff ( set2))

    //=======在数据库中的集合运算


  }

}
